<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<link rel="stylesheet" media="screen" href="css/docs.css" />
<link rel="stylesheet" media="screen" href="lib/datatables/css/vpad.css" />

<!-- jQplot SETUP END -->
<s:if test="#request.insurance != null && #request.insurance.id > 0">
	<h1 class="page-title">社保管理-方案修改</h1>
</s:if>
<s:else>
	<h1 class="page-title">社保管理-方案添加</h1>
</s:else>

<div class="container_12 clearfix leading">
	<form id="post_form" name="post_form">
		<s:if test="#request.insurance != null && #request.insurance.id > 0">
			<input type="hidden" name="insurance.id" value="${insurance.id}" />
		</s:if>
		<input type="hidden" name="insurance.organization.id"
			value="${insurance.organization.id}" />
		<div class="clear"></div>
		<h5>
			社保方案：<strong> <input id="title" name="insurance.title"
				type="text" value="${insurance.title}" style="width: 30%"></strong>
		</h5>
		<div class="container_12 clearfix"
			style="margin-left: 0px; margin-right: 0px">

			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>养老保险缴费基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="oldageInsuranceBaseType" style="opacity: 0;"
									name="insurance.oldageInsuranceBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.oldageInsuranceBaseType != null && #request.insurance.oldageInsuranceBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.oldageInsuranceBaseType != null && #request.insurance.oldageInsuranceBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.oldageInsuranceBaseType != null && #request.insurance.oldageInsuranceBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.oldageInsuranceBaseType != null && #request.insurance.oldageInsuranceBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.oldageInsuranceBaseType != null && #request.insurance.oldageInsuranceBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="oldageBase"
										name="insurance.oldageBase" type="text" style="width: 60px"
										value="${insurance.oldageBase}" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
			<!-- 工伤保险 -->
			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>工伤保险金基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="injuryInsuranceBaseType" style="opacity: 0;"
									name="insurance.injuryInsuranceBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.injuryInsuranceBaseType != null && #request.insurance.injuryInsuranceBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.injuryInsuranceBaseType != null && #request.insurance.injuryInsuranceBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.injuryInsuranceBaseType != null && #request.insurance.injuryInsuranceBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.injuryInsuranceBaseType != null && #request.insurance.injuryInsuranceBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.injuryInsuranceBaseType != null && #request.insurance.injuryInsuranceBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="injuryBase"
										name="insurance.injuryBase" type="text" style="width: 60px"
										value="${insurance.injuryBase}" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
			<!-- 失业保险 -->
			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>失业保险缴费基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="unemploymentInsuranceBaseType" style="opacity: 0;"
									name="insurance.unemploymentInsuranceBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.unemploymentInsuranceBaseType != null && #request.insurance.unemploymentInsuranceBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.unemploymentInsuranceBaseType != null && #request.insurance.unemploymentInsuranceBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.unemploymentInsuranceBaseType != null && #request.insurance.unemploymentInsuranceBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.unemploymentInsuranceBaseType != null && #request.insurance.unemploymentInsuranceBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.unemploymentInsuranceBaseType != null && #request.insurance.unemploymentInsuranceBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="unemploymentBase"
										name="insurance.unemploymentBase" type="text" style="width: 60px"
										value="${insurance.unemploymentBase}" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
			<!-- 生育保险 -->
			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>生育保险金基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="birthInsuranceBaseType" style="opacity: 0;"
									name="insurance.birthInsuranceBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.birthInsuranceBaseType != null && #request.insurance.birthInsuranceBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.birthInsuranceBaseType != null && #request.insurance.birthInsuranceBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.birthInsuranceBaseType != null && #request.insurance.birthInsuranceBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.birthInsuranceBaseType != null && #request.insurance.birthInsuranceBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.birthInsuranceBaseType != null && #request.insurance.birthInsuranceBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="birthBase"
										name="insurance.birthBase" type="text" style="width: 60px"
										value="${insurance.birthBase}" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
			<!-- 医疗保险 -->
			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>医疗保险缴费基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="medicalInsuranceBaseType" style="opacity: 0;"
									name="insurance.medicalInsuranceBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.medicalInsuranceBaseType != null && #request.insurance.medicalInsuranceBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.medicalInsuranceBaseType != null && #request.insurance.medicalInsuranceBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.medicalInsuranceBaseType != null && #request.insurance.medicalInsuranceBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.medicalInsuranceBaseType != null && #request.insurance.medicalInsuranceBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.medicalInsuranceBaseType != null && #request.insurance.medicalInsuranceBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="medicalInsuranceBase"
										name="insurance.medicalInsuranceBase" type="text" style="width: 60px"
										value="${insurance.medicalInsuranceBase}" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
			<!-- 公积金 -->
			<div class="portlet grid_6" style="padding-bottom: 20px">
				<header>
					<h6>住房公积金基数</h6>
				</header>

				<section>
					<table class="display" id="example" style="clear: none">
						<thead>
							<tr>
								<th>挂钩数据</th>
								<th>手动输入</th>
							</tr>
						</thead>
						<tbody>
							<tr class="gradeA">
								<td><select id="fundBaseType" style="opacity: 0;"
									name="insurance.fundBaseType">
										<option value="no_linked"
											<s:if test="#request.insurance.fundBaseType != null && #request.insurance.fundBaseType.toString().equals('no_linked')">selected="selected"</s:if>>无挂钩数据(手动输入)</option>
										<option value="employee_base_salary"
											<s:if test="#request.insurance.fundBaseType != null && #request.insurance.fundBaseType.toString().equals('employee_base_salary')">selected="selected"</s:if>>和员工基本工资挂钩</option>
										<option value="employee_performance"
											<s:if test="#request.insurance.fundBaseType != null && #request.insurance.fundBaseType.toString().equals('employee_performance')">selected="selected"</s:if>>和员工绩效奖金挂钩</option>
										<option value="employee_salary_performance"
											<s:if test="#request.insurance.fundBaseType != null && #request.insurance.fundBaseType.toString().equals('employee_salary_performance')">selected="selected"</s:if>>和员工基本工资+绩效奖金挂钩</option>
										<option value="salary_framework"
											<s:if test="#request.insurance.fundBaseType != null && #request.insurance.fundBaseType.toString().equals('salary_framework')">selected="selected"</s:if>>和薪资框架中的项目总和挂钩</option>
								</select></td>
								<td><strong> <input id="fundBase"
										name="insurance.fundBase" type="text"
										value="${insurance.fundBase}" style="width: 60px" /> 元
								</strong></td>
							</tr>
						</tbody>
					</table>
				</section>
			</div>
		</div>
		<div class="portlet leading">
			<header>
				<h6 style="margin-bottom: 0px">
					<a href="javascript:void(0)"><span
						style="background: url(${ctx}/images/img/user_gray.png)"
						class="icon">&nbsp;</span>个人缴费部分</a>
				</h6>
			</header>
			<s:if test="(#request.insurance.details != null && #request.personalItemLength > 0) || #request.insurance.details == null || #request.insurance.details.size() == 0">
			<section class="tabs side">
				<ul class="clearfix" style="width: 150px"
					id="insdetail_tabs_personal">
					<s:if
						test="#request.insurance.details != null && #request.insurance.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.insurance.details">
							<s:if
								test="#dt.projectType != null && #dt.projectType.toString().equals('personal')">
								<li style="width: 150px"><a href="javascript:void(0)"
									onclick="tabChangeEvent(this,'personal')"><span
										style="background: url(${ctx}/images/img/user_gray.png)"
										class="icon">&nbsp;</span><span>${dt.projectTitle}</span></a></li>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<li style="width: 150px"><a
							onclick="tabChangeEvent(this,'personal')"
							href="javascript:void(0)" class="current"><span class="icon"
								style="background: url(/images/img/house.png)">&nbsp;</span><span></span></a></li>
					</s:else>
				</ul>
				<section style="margin-left: 150px" id="insdetail_sections_personal">
					<s:if
						test="#request.insurance.details != null && #request.insurance.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.insurance.details">
							<s:if test="#dt.projectType.toString().equals('personal')">
								<section class="clearfix"
									<s:if test="#st.index == 0">style="display:block"</s:if>
									<s:else>style="display:none"</s:else>>
									<h6>
										项目名称：<strong><select name="insuranceType_personal">
												<option value="oldageinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('oldageinsurance')">selected="selected"</s:if>>养老缴费基数</option>
												<option value="injuryinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('injuryinsurance')">selected="selected"</s:if>>工伤缴费基数</option>
												<option value="unemploymentinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('unemploymentinsurance')">selected="selected"</s:if>>失业缴费基数</option>
												<option value="birthinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('birthinsurance')">selected="selected"</s:if>>生育缴费基数</option>
												<option value="medicalinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('medicalinsurance')">selected="selected"</s:if>>医疗缴费基数</option>
												<option value="fund"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('fund')">selected="selected"</s:if>>公积金缴费基数</option>
										</select><input name="projectTitle_personal" type="text"
											style="width: 30%" value="${dt.projectTitle}"></strong><strong>
											<input name="occupancyRate_personal" type="text"
											style="width: 60px" value="${dt.occupancyRate}" />
										</strong>%
									</h6>
									<div class="tabs side grid_12 leading">
										<div class="clear"></div>
										<div class="grid_12">
											<div class="form-action clearfix">
												<p>
													<a name="modify" class="button" href="javascript:void(0)"
														onclick="modifyScheme(this,'personal')"><span
														style="background: url(${ctx}/images/img/page_edit.png)"
														class="icon">&nbsp;</span>提交</a> <a name="delete"
														class="button" href="javascript:void(0)"
														onclick="deleteScheme(this,'personal')"><span
														style="background: url(${ctx}/images/img/cancel.png)"
														class="icon">&nbsp;</span>删除</a>
												</p>
											</div>
										</div>
									</div>
								</section>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<section class="clearfix"
							<s:if test="#st.index == 0">style="display:block"</s:if>
							<s:else>style="display:none"</s:else>>
							<h6>
								项目名称：<strong><select name="insuranceType_personal">
										<option value="oldageinsurance">养老缴费基数</option>
										<option value="injuryinsurance">工伤缴费基数</option>
										<option value="unemploymentinsurance">失业缴费基数</option>
										<option value="birthinsurance">生育缴费基数</option>
										<option value="medicalinsurance">医疗缴费基数</option>
										<option value="fund">公积金缴费基数</option>
								</select> <input name="projectTitle_personal" type="text"
									style="width: 30%" value=""></strong><strong> <input
									name="occupancyRate_personal" type="text" style="width: 60px"
									value="" />
								</strong>%
							</h6>
							<div class="tabs side grid_12 leading">
								<div class="clear"></div>
								<div class="grid_12">
									<div class="form-action clearfix">
										<p>
											<a name="modify" class="button" href="javascript:void(0)"
												onclick="modifyScheme(this,'personal')"><span
												style="background: url(${ctx}/images/img/page_edit.png)"
												class="icon">&nbsp;</span>提交</a> <a name="delete" class="button"
												href="javascript:void(0)"
												onclick="deleteScheme(this,'personal')"><span
												style="background: url(${ctx}/images/img/cancel.png)"
												class="icon">&nbsp;</span>删除</a>
										</p>
									</div>
								</div>
							</div>
						</section>
					</s:else>
				</section>
				<div class="container_12 clearfix leading"
					style="padding-left: 20px">
					<div class="form-action clearfix" style="margin-left: 115px">
						<p>
							<a class="button" href="javascript:void(0)"
								onclick="appendScheme('personal')"><span
								style="background: url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加项目</a>
						</p>
					</div>
				</div>
			</section>
			</s:if>
		</div>
		<div class="portlet leading">
			<header>
				<h6 style="margin-bottom: 0px">
					<a href="javascript:void(0)"><span
						style="background: url(${ctx}/images/img/house.png)" class="icon">&nbsp;</span>公司缴费部分</a>
				</h6>
			</header>
			<s:if test="(#request.insurance.details != null && #request.companyItemLength > 0) || #request.insurance.details == null || #request.insurance.details.size() == 0">
			<section class="tabs side">
				<ul class="clearfix" style="width: 150px"
					id="insdetail_tabs_company">
					<s:if
						test="#request.insurance.details != null && #request.insurance.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.insurance.details">
							<s:if test="#dt.projectType.toString().equals('company')">
								<li style="width: 150px"><a href="javascript:void(0)"
									onclick="tabChangeEvent(this,'company')"><span
										style="background: url(${ctx}/images/img/user_gray.png)"
										class="icon">&nbsp;</span><span>${dt.projectTitle}</span></a></li>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<li style="width: 150px"><a
							onclick="tabChangeEvent(this,'company')"
							href="javascript:void(0)" class="current"><span class="icon"
								style="background: url(${ctx}/images/img/house.png)">&nbsp;</span><span></span></a></li>
					</s:else>
				</ul>
				<section style="margin-left: 150px" id="insdetail_sections_company">
					<s:if
						test="#request.insurance.details != null && #request.insurance.details.size() > 0">
						<s:iterator var="dt" status="st"
							value="#request.insurance.details">
							<s:if test="#dt.projectType.toString().equals('company')">
								<section class="clearfix"
									<s:if test="#st.index == 0">style="display:block"</s:if>
									<s:else>style="display:none"</s:else>>
									<h6>
										项目名称：<strong><select name="insuranceType_company">
												<option value="oldageinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('oldageinsurance')">selected="selected"</s:if>>养老缴费基数</option>
												<option value="injuryinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('injuryinsurance')">selected="selected"</s:if>>工伤缴费基数</option>
												<option value="unemploymentinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('unemploymentinsurance')">selected="selected"</s:if>>失业缴费基数</option>
												<option value="birthinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('birthinsurance')">selected="selected"</s:if>>生育缴费基数</option>
												<option value="medicalinsurance"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('medicalinsurance')">selected="selected"</s:if>>医疗缴费基数</option>
												<option value="fund"
													<s:if test="#dt.insuranceType != null && #dt.insuranceType.toString().equals('fund')">selected="selected"</s:if>>公积金缴费基数</option>
										</select> <input name="projectTitle_company" type="text"
											style="width: 30%" value="${dt.projectTitle}"></strong><strong>
											<input name="occupancyRate_company" type="text"
											style="width: 60px" value="${dt.occupancyRate}" />
										</strong>%
									</h6>
									<div class="tabs side grid_12 leading">
										<div class="clear"></div>
										<div class="grid_12">
											<div class="form-action clearfix">
												<p>
													<a name="modify" class="button" href="javascript:void(0)"
														onclick="modifyScheme(this,'company')"><span
														style="background: url(${ctx}/images/img/page_edit.png)"
														class="icon">&nbsp;</span>修改</a> <a name="delete"
														class="button" href="javascript:void(0)"
														onclick="deleteScheme(this,'company')"><span
														style="background: url(${ctx}/images/img/cancel.png)"
														class="icon">&nbsp;</span>删除</a>
												</p>
											</div>
										</div>
									</div>
								</section>
							</s:if>
						</s:iterator>
					</s:if>
					<s:else>
						<section class="clearfix">
							<h6>
								项目名称：<strong><select name="insuranceType_company">
										<option value="oldageinsurance" selected="selected">养老缴费基数</option>
										<option value="injuryinsurance">工伤缴费基数</option>
										<option value="unemploymentinsurance">失业缴费基数</option>
										<option value="birthinsurance">生育缴费基数</option>
										<option value="medicalinsurance">医疗缴费基数</option>
										<option value="fund">公积金缴费基数</option>
								</select> <input name="projectTitle_company" type="text"
									style="width: 30%" value=""></strong><strong> <input
									name="occupancyRate_company" type="text" style="width: 60px"
									value="" />
								</strong>%
							</h6>
							<div class="tabs side grid_12 leading">
								<div class="clear"></div>
								<div class="grid_12">
									<div class="form-action clearfix">
										<p>
											<a name="modify" class="button" href="javascript:void(0)"
												onclick="modifyScheme(this,'company')"><span
												style="background: url(${ctx}/images/img/page_edit.png)"
												class="icon">&nbsp;</span>提交</a> <a name="delete" class="button"
												href="javascript:void(0)"
												onclick="deleteScheme(this,'company')"><span
												style="background: url(${ctx}/images/img/cancel.png)"
												class="icon">&nbsp;</span>删除</a>
										</p>
									</div>
								</div>
							</div>
						</section>
					</s:else>
				</section>
				<div class="clear"></div>
				<div class="container_12 clearfix leading"
					style="padding-left: 20px">
					<div class="form-action clearfix" style="margin-left: 115px">
						<p>
							<a class="button" href="javascript:void(0)"
								onclick="appendScheme('company')"><span
								style="background: url(${ctx}/images/img/add.png)" class="icon">&nbsp;</span>添加项目</a>
						</p>
					</div>
				</div>
			</section>
			</s:if>
		</div>
		<div class="clear"></div>
		<div class="tabs side grid_12 leading">
			<div class="clear"></div>
		</div>
	</form>
</div>
<div class="clear"></div>
<div class="container_12 clearfix leading" style="padding-left: 20px">
	<div class="form-action clearfix">
		<p>
			<a class="button" href="javascript:void(0)" onclick="checkForm()"><span
				style="background: url(${ctx}/images/img/page_edit.png)"
				class="icon">&nbsp;</span>确定提交</a> <a class="button"
				href="#salary/insurance_main.xhtml?organizationId=${insurance.organization.id}"><span
				style="background: url(${ctx}/images/img/arrow_undo.png)"
				class="icon">&nbsp;</span>返回</a>
		</p>
	</div>
</div>
<script type="text/javascript" src="${ctx}/js/global_util.js"></script>
<script type="text/javascript">
	/**
	 * 添加项目模块
	 */
	function appendScheme(mod) {
		//remove the current activity div
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod).find("section").attr("style",
				"display:none");
		var tabHTML = "<li style=\"width: 150px\"><a class=\"current\" href=\"javascript:void(0)\" onclick=\"tabChangeEvent(this,'"
				+ mod
				+ "')\"><span style=\"background: url(${ctx}/images/img/house.png)\" class=\"icon\">&nbsp;</span><span></span></a></li>";
		var sectionHTML = "<section class=\"clearfix\">";
		sectionHTML += "		<h6>";
		sectionHTML += "		项目名称：<strong><select name=\"insuranceType_" + mod + "\">";
		sectionHTML += "			<option value=\"oldageinsurance\" selected=\"selected\">养老缴费基数</option>";
		sectionHTML += "			<option value=\"injuryinsurance\">工伤缴费基数</option>";
		sectionHTML += "			<option value=\"unemploymentinsurance\">失业缴费基数</option>";
		sectionHTML += "			<option value=\"birthinsurance\">生育缴费基数</option>";
		sectionHTML += "			<option value=\"medicalinsurance\">医疗缴费基数</option>";
		sectionHTML += "			<option value=\"fund\">公积金缴费基数</option>";
		sectionHTML += "			</select> <input name=\"projectTitle_" + mod
				+ "\" type=\"text\"";
		sectionHTML += "				style=\"width: 30%\"></strong><strong> <input";
		sectionHTML +="				name=\"occupancyRate_" + mod + "\" type=\"text\" style=\"width: 60px\" />";
		sectionHTML += "				</strong>%";
		sectionHTML += "		</h6>";
		sectionHTML += "		<div class=\"tabs side grid_12 leading\">";
		sectionHTML += "			<div class=\"clear\"></div>";
		sectionHTML += "			<div class=\"grid_12\">";
		sectionHTML += "				<div class=\"form-action clearfix\">";
		sectionHTML += "				<p>";
		sectionHTML += "					<a name=\"modify\" class=\"button\" href=\"javascript:void(0)\" onclick=\"modifyScheme(this,'"
				+ mod + "')\"><span";
		sectionHTML += "					style=\"background: url(${ctx}/images/img/page_edit.png)\" class=\"icon\">&nbsp;</span>提交</a>";
		sectionHTML += "					<a name=\"delete\" class=\"button\" onclick=\"deleteScheme(this,'"
				+ mod + "')\"><span";
		sectionHTML += "					style=\"background: url(${ctx}/images/img/cancel.png)\" class=\"icon\">&nbsp;</span>删除</a>";
		sectionHTML += "				</p>";
		sectionHTML += "				</div>";
		sectionHTML += "			</div>";
		sectionHTML += "		</div>";
		sectionHTML += "</section>";
		$("#insdetail_tabs_" + mod).append(tabHTML);
		$("#insdetail_sections_" + mod).append(sectionHTML);
	}

	/**
	 * ul li item to click.
	 */
	function tabChangeEvent(clkObj, mod) {
		var ci = 0;
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod).find("section").attr("style",
				"display:none");
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (this == clkObj) {
				$(this).addClass("current");
				ci = i;
			}
		});
		$("#insdetail_sections_" + mod).find("section").each(function(i) {
			if (ci == i) {
				$(this).attr("style", "display:block");
			}
		});
	}

	function focusTabCallBack(ci, mod) {
		$("#insdetail_tabs_" + mod).find("a").removeClass("current");
		$("#insdetail_sections_" + mod).find("section").attr("style",
				"display:none");
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (ci == i) {
				$(this).addClass("current");
			}
		});
		$("#insdetail_sections_" + mod).find("section").each(function(i) {
			if (ci == i) {
				$(this).attr("style", "display:block");
			}
		});
	}

	/**
	 *	段落确定修改
	 */
	function modifyScheme(clkObj, mod) {
		var ci = 0;
		var mvalue = "";
		$("#insdetail_sections_" + mod).find("a[name='modify']").each(
				function(i) {
					if (this == clkObj) {
						ci = i;
					}
				});
		$("#insdetail_sections_" + mod).find("section")
				.each(
						function(i) {
							if (ci == i) {
								mvalue = $(this).find(
										"input[name='projectTitle_" + mod
												+ "']").val();
							}
						});
		$("#insdetail_tabs_" + mod).find("a").each(function(i) {
			if (ci == i) {
				$(this).find("span:last").html(mvalue);
			}
		});
		
		if(mvalue != ""){
			$(clkObj).html("<span class=\"icon\" style=\"background: url(${ctx}/images/img/page_edit.png)\">&nbsp;</span>修改");
		}
	}

	/**
	 * 删除段落
	 */
	function deleteScheme(clkObj, mod) {
		if (confirm("确定要删除吗？")) {
			var ci = 0;
			$("#insdetail_sections_" + mod).find("a[name='delete']").each(
					function(i) {
						if (this == clkObj) {
							ci = i;
						}
					});
			$("#insdetail_sections_" + mod).find("section").each(function(i) {
				if (ci == i) {
					$(this).remove();
				}
			});
			$("#insdetail_tabs_" + mod).find("li").each(function(i) {
				if (ci == i) {
					$(this).remove();
				}
			});
			$("#insdetail_sections_" + mod + " section:last").attr("style",
					"display:block");
			$("#insdetail_tabs_" + mod + " a:last").addClass("current");
		}
	}

	function checkForm() {
		if (checkNull($("#title").attr("value"))) {
			alert("方案名称不能空");
			$("#title").focus();
			return false;
		}
		if ($("#oldageInsuranceBaseType").val() == "no_linked") {
			if (checkNull($("#oldageBase").attr("value"))) {
				alert("养老缴费基数不能为空");
				$("#oldageBase").focus();
				return false;
			}

			if (isNaN($("#oldageBase").val())) {
				alert("养老缴费基数只能填写数字");
				$("#oldageBase").focus();
				return false;
			}
		}
		
		if ($("#injuryInsuranceBaseType").val() == "no_linked") {
			if (checkNull($("#injuryBase").attr("value"))) {
				alert("工伤缴费基数不能为空");
				$("#injuryBase").focus();
				return false;
			}

			if (isNaN($("#injuryBase").val())) {
				alert("工伤缴费基数只能填写数字");
				$("#injuryBase").focus();
				return false;
			}
		}
		
		if ($("#unemploymentInsuranceBaseType").val() == "no_linked") {
			if (checkNull($("#unemploymentBase").attr("value"))) {
				alert("失业缴费基数不能为空");
				$("#unemploymentBase").focus();
				return false;
			}

			if (isNaN($("#unemploymentBase").val())) {
				alert("失业缴费基数只能填写数字");
				$("#unemploymentBase").focus();
				return false;
			}
		}
		
		if ($("#birthInsuranceBaseType").val() == "no_linked") {
			if (checkNull($("#birthBase").attr("value"))) {
				alert("生育缴费基数不能为空");
				$("#birthBase").focus();
				return false;
			}

			if (isNaN($("#birthBase").val())) {
				alert("生育缴费基数只能填写数字");
				$("#birthBase").focus();
				return false;
			}
		}
		
		if ($("#medicalInsuranceBaseType").val() == "no_linked") {
			if (checkNull($("#medicalInsuranceBase").attr("value"))) {
				alert("医疗缴费基数不能为空");
				$("#medicalInsuranceBase").focus();
				return false;
			}

			if (isNaN($("#medicalInsuranceBase").val())) {
				alert("医疗缴费基数只能填写数字");
				$("#medicalInsuranceBase").focus();
				return false;
			}
		}

		if ($("#fundBaseType").val() == "no_linked") {
			if (checkNull($("#fundBase").attr("value"))) {
				alert("住房公积金基数不能为空");
				$("#insuranceBase").focus();
				return false;
			}

			if (isNaN($("#fundBase").val())) {
				alert("住房公积金基数只能填写数字");
				$("#insuranceBase").focus();
				return false;
			}
		}
		var checkScheme = true;
		//检测项目组
		$("input[name='projectTitle_personal']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("个人缴费项目名称不能为空");
				$(this).focus();
				focusTabCallBack(i, "personal");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		//比例
		$("input[name='occupancyRate_personal']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("个人缴费项目比例不能为空");
				$(this).focus();
				focusTabCallBack(i, "personal");
				checkScheme = false;
			}
			if (isNaN($(this).val())) {
				alert("个人缴费项目比例只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "personal");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		//检测个人缴费项目组结束
		$("input[name='projectTitle_company']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("公司缴费项目名称不能为空");
				$(this).focus();
				focusTabCallBack(i, "company");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}

		//比例
		$("input[name='occupancyRate_company']").each(function(i) {
			if (checkNull($(this).val())) {
				alert("个人缴费项目比例不能为空");
				$(this).focus();
				focusTabCallBack(i, "company");
				checkScheme = false;
			}
			if (isNaN($(this).val())) {
				alert("个人缴费项目比例只能为数字");
				$(this).val("");
				$(this).focus();
				focusTabCallBack(i, "company");
				checkScheme = false;
			}
		});
		if (!checkScheme) {
			return false;
		}
		//公司项目组结束
		var url = "${ctx}/salary/post_insurance.xhtml";
		$
				.ajax(
						url,
						{
							type : "POST",
							data : $("#post_form").serialize(),
							dataType : "html",
							cache : false,
							success : function(a) {
								alert("提交成功");
								window.location.href = "${ctx}/index.xhtml#salary/insurance_main.xhtml?organizationId=${insurance.organization.id}";
							},
							error : function(XMLHttpRequest, textStatus,
									errorThrown) {
								alert('提交申请发生异常');
							},
							complete : function() {
							}
						});
	}

	
</script>